using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShivamEMR.Model.Domain.CompanyDomain;
using ShivamEMR.Model.DataInterfaces.CompanyDataInterf;
using ShivamEMR.Model;
//using ShivamEMR.Web.Areas.Company.Models;

namespace ShivamEMR.Web.Areas.Company.Controllers
{   
    public class ScheduleStatusController : Controller
    {
        private readonly IScheduleSatatusRepository schedulestatusRepository;

		// If you are using Dependency Injection, you can delete the following constructor
        public ScheduleStatusController() 
        {
            schedulestatusRepository = Registry.RepositoryFactory.GetScheduleStatusRepository();
        }

        public ScheduleStatusController(IScheduleSatatusRepository schedulestatusRepository)
        {
			this.schedulestatusRepository = schedulestatusRepository;
        }

        //
        // GET: /ScheduleStatus/

        public ViewResult Index()
        {
            //return View(schedulestatusRepository.AllIncluding(schedulestatus => schedulestatus.Schedules));
            return View(schedulestatusRepository.All);
        }

        //
        // GET: /ScheduleStatus/Details/5

        public ViewResult Details(int id)
        {
            return View(schedulestatusRepository.Find(id));
        }

        //
        // GET: /ScheduleStatus/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /ScheduleStatus/Create

        [HttpPost]
        public ActionResult Create(ScheduleStatus schedulestatus)
        {
            if (ModelState.IsValid) {
                schedulestatusRepository.Create(schedulestatus);
                schedulestatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }
        
        //
        // GET: /ScheduleStatus/Edit/5
 
        public ActionResult Edit(int id)
        {
             return View(schedulestatusRepository.Find(id));
        }

        //
        // POST: /ScheduleStatus/Edit/5

        [HttpPost]
        public ActionResult Edit(ScheduleStatus schedulestatus)
        {
            if (ModelState.IsValid) {
                schedulestatusRepository.Update(schedulestatus);
                schedulestatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }

        //
        // GET: /ScheduleStatus/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View(schedulestatusRepository.Find(id));
        }

        //
        // POST: /ScheduleStatus/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            var scstatus = schedulestatusRepository.Find(id);            
            schedulestatusRepository.Delete(scstatus);
            schedulestatusRepository.Save();
            return RedirectToAction("Index");
        }
    }
}

